home *** CD-ROM | disk | FTP | other *** search
- % -----------------------------------------------------------------------------
- % Login automation *TERMINATE PRESCRIPTION*
- % -----------------------------------------------------------------------------
- %
- % Version : 1.00
- % Filename : AUTOCALL.TSL
- % Company : SerWiz Comm
- % Programmer : Bo Bendtsen
- % Module created : 08 Apr 1997
- % Latest revision : 08 Apr 1997 by Bo Bendtsen
- % Language/version : Terminate Prescription 1.00
- % Remarks : Demonstration of how to call, login and hangup
- %
- % -----------------------------------------------------------------------------
-
- Set DialNumber = "01713941230"
- Set Username = "Bo Bendtsen"
- Set Password = "secret"
-
- Set DialCmd = "ATDT"
- Set DialTime = 60
- Set Retries = 3
- Set RetryDelay = 5
- Set SendEscapes = 0
-
- Function GetString(ReturnString,Timeout)
- Set LastChar=""
- Set Key=0
- ResetTimer 1,Timeout
- Repeat
- If CharsWaiting<>0
- Set LastChar=GetChar
- If (LastChar<>Chr(13)) & (LastChar<>Chr(10))
- Set ReturnString=ReturnString+LastChar
- Endif
- Endif
- If Keypressed<>0
- Set Key = GetKey
- Endif
- Until (LastChar=Chr(10)) | (TimerExpired(1)=1) | (Key=27)
- EndFunc ReturnString
-
- Function SendModem(ModemString)
- Send ModemString
- Send Chr(13)
- Wait 250
- EndFunc 0
-
- Set Tries=0
-
- :DialUp
- PrintLn
- PrintLn "Dialling: "+DialNumber
- SendModem(DialCmd+DialNumber)
- Set ModemResult=GetString("",3)
- If Key=27
- Goto End
- Endif
-
- :WaitString
- Set ModemResult=GetString("",DialTime)
- If Key=27
- Goto End
- Endif
-
- If ModemResult=""
- If TimerExpired(1)=1
- Goto End
- Endif
- Goto WaitString
- Endif
-
- If Pos("CONNECT",ModemResult)=1
- Goto Connected
- Endif
-
- If ModemResult = "RINGING"
- PrintLn "Ringing"
- Goto WaitString
- Endif
-
- If ModemResult = "BUSY"
- Goto Busy
- Endif
-
- If ModemResult = "NO CARRIER"
- Goto NoCarrier
- Endif
-
- If ModemResult = "NO DIALTONE"
- Goto NoDialTone
- Endif
-
- PrintLn "Unknown result: '"+ModemResult+"'"
- Goto End
-
- :Connected
- PrintLn "Connected"
- Wait 200
- If SendEscapes=1
- Send Chr(27)+Chr(27)
- Endif
- WaitFor "Name",30
- If IOResult<>0
- Goto End
- Endif
- Send Username+Chr(13)
- WaitFor "Password",30
- If IOResult<>0
- Goto End
- Endif
-
- Wait 100
-
- % Here you could insert you own code to automate the task you need
- % to perform like uploading or downloading a file.
- % You can also LEARN a script and insert at this location.
-
- % Download 1
- % Upload 1,"C:\AUTOEXEC.BAT C:\CONFIG.SYS"
-
- Wait 100
-
- Goto End
-
- :Busy
- PrintLn "Line was Busy"
- Set Tries=Tries+1
- If (Tries<Retries) | (Retries=0)
- Send Chr(13)+Chr(13)
- Wait 100
- PrintLn "Retrying in "+RetryDelay+" seconds"
- Wait RetryDelay*100
- Goto DialUp
- Endif
- PrintLn "To many busytries"
- Goto End
-
- :NoCarrier
- PrintLn "No carrier"
- Goto End
-
- :NoDialTone
- PrintLn "No dialtone"
- Goto End
-
- :End
- Hangup
- PrintLn "End."
-
-